import turtle
import random

# rabbit_shape = [(0, 0), (-5, 0), (5, 0), (-10, 0), (10, 0), (-20, -10), (20, -10), (-9, -10), (9, -10), (-12, -20),
#                 (12, -20),
#                 (-5, -25), (5, -25)]
# turtle.register_shape("rabbit", rabbit_shape)

wugui = turtle.Turtle()
wugui.shape('turtle')
wugui.pencolor('black')
rabbit1 = turtle.Turtle()
rabbit1.shape('arrow')
rabbit1.pencolor('blue')


def main():
    global wugui
    global rabbit1
    finishline = 200
    wugui.penup()
    rabbit1.penup()
    wugui.goto(-200, -50)
    rabbit1.goto(-200, 0)
    wugui.pendown()
    rabbit1.pendown()
    flag = True

    while flag:
        rxcor = rabbit1.xcor()
        wxocr = wugui.xcor()
        wugui.forward(random.randint(0, 5))
        if rxcor > 0 and wxocr < 150:
            pass
        else:
            rabbit1.forward(random.randint(7, 10))
        if wxocr >= finishline:
            print("the winner is wugui")
            flag = False
        if rxcor >= finishline:
            print("the winner is rabbit")
            flag = False
    turtle.done()


main()
